import React, { Component } from 'react'
import { localClass } from './style.scss'

export default class ContentSideNav extends Component {
  static defaultProps = {
    list : [],
    onItemClick : ()=>{}
  }
  render() {
    const {list, activeKey, onItemClick} = this.props;
    return (
      <div className={localClass}>
        <ul className="sidenavlist">
            { list.map((item, index)=> <li key={index} className={activeKey === index? 'on':''} onClick={ ()=>{ onItemClick({item, index}); } }>{item.title}</li> ) }
        </ul>
      </div>
    )
  }
}